var a = "1234567890";
let reg = /(\d)(?=(\d{3})+$)/g;
// console.log(a.match(reg))
console.log(a.replace(reg,"$1,"))